import { EFFECT } from '../../game/AssetsConfig';
import AudioManager from '../manager/AudioManager';

import { _decorator, CCString, Component, Node } from 'cc';
const { ccclass, property, menu } = _decorator;

@ccclass
@menu('ComUtils/ButtonEffect')
export default class ButtonEffect extends Component {
  @property(CCString)
  soundAsset: string = 'BUTTON_CLICK';

  playSound() {
    if (EFFECT[this.soundAsset]) {
      AudioManager.Ins.playSound(EFFECT[this.soundAsset]);
    } else {
      // console.error("错误的声音名称", this.soundAsset)
    }
  }
}

// @ts-ignore
cc.ButtonEffect = ButtonEffect;
